import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from "vue-router";
import Layout from "@/components/Layout.vue";

const router = createRouter({
  history:
    process.env.NODE_ENV === "production"
      ? createWebHistory()
      : createWebHashHistory(),
  routes: [
    {
      path: "/",
      name: "layout",
      component: Layout,
      children: [
        {
          path: "",
          name: "index",
          component: () => import("@/view/index/Index.vue"),
        },
        {
          path: "page/:param.html",
          name: "page",
          component: () => import("@/view/list/List.vue"),
        },
        {
          path: "android/:param.html",
          name: "android",
          component: () => import("@/view/android/List.vue"),
        },
        {
          path: "ios/:param.html",
          name: "ios",
          component: () => import("@/view/ios/List.vue"),
        },
        {
          path: "soft/detail_:id.html",
          name: "detail",
          component: () => import("@/view/detail/Detail.vue"),
        },
        {
          path: "game/index.html",
          name: "game-index",
          component: () => import("@/view/game/Index.vue"),
        },
        {
          path: "game/alone-list_:param.html",
          name: "game-alone-ist",
          component: () => import("@/view/game/AloneList.vue"),
        },
        {
          path: "game/mobile-list_:param.html",
          name: "game-mobile-list",
          component: () => import("@/view/game/MobileList.vue"),
        },
        {
          path: "game/mobile-index_:param.html",
          name: "game-mobile-index",
          component: () => import("@/view/game/AllList.vue"),
        },
        {
          path: "game/web-list_:param.html",
          name: "game-web-list",
          component: () => import("@/view/game/WebGame.vue"),
        },
        {
          path: "search_:name.html",
          name: "search",
          component: () => import("@/view/search/Index.vue"),
        },
        {
          path: "information/index.html",
          name: "information",
          component: () => import("@/view/information/Index.vue"),
        },
        {
          path: "information/detail_:id.html",
          name: "information-detail",
          component: () => import("@/view/information/Detail.vue"),
        },
        {
          path: "information/list_:param.html",
          name: "information-list",
          component: () => import("@/view/information/List.vue"),
        },
        {
          path: "map_:id.html",
          name: "map",
          component: () => import("@/view/map/Index.vue"),
        }
      ],
    },
    { path: "/:pathMatch(.*)*", redirect: "/" },
  ],
});

export default router;
